pkgname=golang-1.22
pkgver=1
pkgrel=1.22
pkgdesc="golang 1.22.1 my build version auto change GOPROXY"
url="https://golang.google.cn/"
license=('MIT')
arch=('any')
makedepends=()
source=(https://golang.google.cn/dl/go1.22.1.linux-amd64.tar.gz) # TODO: change here
md5sums=('SKIP')

build() {
  echo "SRC DIR: ${srcdir} ========================================"
  echo "CURRENT DIR: $PWD ========================================="
}

package() {
  echo "SRC DIR: ${srcdir} ========================================"
  echo "CURRENT DIR: $PWD ========================================="
  echo "PKG DIR: ${pkgdir} ========================================"
  #cd go/ # into srcdir go
  sudo mv go/bin/go /usr/local/bin
  go env -w GOPROXY='https://goproxy.cn,direct'
  go env -w GO111MODULE='on' 
  echo "export GOROOT=$HOME" >> ~/.bashrc
  cd ..
  echo "=============== MANUAL DELETE ALL FILE NOW ========================================"
  echo "AND you can delete go by: sudo rm -rf /usr/local/bin"
}
